<%@ page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
<%@ include file="/comm/include.jsp"%>
<script type="text/javascript" src="${ctx}/upload/swfupload.js"></script>
<script type="text/javascript" src="${ctx}/upload/handlers.js"></script>
<LINK REL=StyleSheet HREF="${ctx }/css/form.css" TYPE="text/css">
<script>
var swfu;
$(function(){
		$('#rebateForm').form({  
		    url:'${ctx}/goods/update.htm', 
		    onSubmit: function(){
				return $(this).form('validate');
		    },  
		    success:function(data){
		    	if (data == 1) {
			    	window.location.href= "${ctx}/goods/index.htm";
				}else {
			    	alert('修改失败');
				}
		    }
		}); 
		
	swfu = new SWFUpload({
		upload_url: "${ctx}/service/upload.htm",
		// File Upload Settings
		file_size_limit : "2 MB",	// 1000MB
		file_types : "*.jpg;*.gif;*.png",
		file_types_description : "图像文件",
		file_upload_limit : "0",
						
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,//选择好文件后提交
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,

		// Button Settings
		button_image_url : "${ctx}\\images\\uploadbutton.png",
		button_placeholder_id : "spanButtonPlaceholder",
		button_width: 200,
		button_height: 18,
		button_text : '<span class="button">选择文件</span>',
		button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }',
		button_text_top_padding: 0,
		button_text_left_padding: 18,
		button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
		button_cursor: SWFUpload.CURSOR.HAND,
		
		// Flash Settings
		flash_url : "${ctx}/upload/swfupload.swf",

		custom_settings : {
			upload_target : "divFileProgressContainer"
		},
		// Debug Settings
		debug: false
	});
});
</script>

<div>
	<form id="rebateForm" method="post">
		<div>
			<div class="form-field" style="padding: 1px;" >
				<input type="hidden" name="id" value="${rebateGoods.id }" />
				<p>
					<label class="name" for="merchantId" >商家名称:</label>
					<input type="text"  name="merchantId" class="input" data-options="required:true" value="${rebateGoods.merchantId}"/>
				</p>
				<p>
					<label class="name" for="goodsTitle" >商品名称:</label>
					<input type="text"  name="goodsTitle" class="input" data-options="required:true" value="${rebateGoods.goodsTitle }"/>
				</p>
				<p>
					<label class="name" for="rebateLink" >返利链接:</label>
					<input type="text" id="rebateLink" name="rebateLink" value="${rebateGoods.rebateLink}" class="input"/>
				</p>
				<p>
					<label class="name" for="goodsImg" >图片地址:</label>
					<span id="spanButtonPlaceholder"></span>
					<img id="uploadImg" src="${ctx}/files/${rebateGoods.rebateLink}"/>
					<input type="hidden" id="goodsImg" name="goodsImg" di="1" value="${rebateGoods.rebateLink}"/>
				</p>
				<p align="center" class="form-actions">
					<a id="btnSubmit" href="javascript:;" class="easyui-linkbutton" iconCls="icon-save">保存</a>
					<a id="btnReturn" class="easyui-linkbutton" iconCls="icon-undo">返回</a>
				</p>
			</div>
		</div>
	</form>	
</div>
<script src="${ctx}/script/utils.js" type="text/javascript"></script>